<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>{% block title %}{% endblock %}</title>
    <link rel="icon" type="image/x-icon" href="{{ url_for('static',filename='img/tx.jpg') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/iziToast.min.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}">
    <script>document.documentElement.setAttribute("data-theme", localStorage.getItem("theme") || 'light');</script>
</head>
<body>
<div class="h-full w-full fixed bg-white dark:bg-base-100 z-[60] right-0 flex flex-col items-center justify-center"
     id="masks">
    <div class="text-5xl font-bold">豆瓣数据</div>
    <div class="divider"><span class="loading loading-bars loading-lg"></span></div>
    <div class="text-xl">正在努力加载中...</div>
</div>
<div class="drawer lg:drawer-open">
    <input id="my-drawer-2" type="checkbox" class="drawer-toggle"/>
    <div class="drawer-content">
        <!-- Page content here -->
        <div class="h-16 sticky top-0 shadow dark:shadow-slate-800 z-[50]">
            <div class="navbar bg-base-100">
                <div class="navbar-start block lg:hidden">
                    <label tabindex="0" role="button" for="my-drawer-2"
                           class="btn btn-ghost btn-circle drawer-button">
                        <svg
                                xmlns="http://www.w3.org/2000/svg"
                                class="h-5 w-5"
                                fill="none"
                                viewBox="0 0 24 24"
                                stroke="currentColor">
                            <path
                                    stroke-linecap="round"
                                    stroke-linejoin="round"
                                    stroke-width="2"
                                    d="M4 6h16M4 12h16M4 18h7"/>
                        </svg>
                    </label>
                </div>
                <div class="navbar-center lg:navbar-start">
                    <div class="btn btn-ghost text-xl">
                        <span class="countdown font-mono">
                          <span id="hour"></span>:
                          <span id="minute"></span>:
                          <span id="second"></span>
                        </span>
                    </div>
                </div>
                <div class="navbar-end">
                    <label class="swap swap-rotate">
                        <input type="checkbox" id="theme-switch"/>
                        <svg class="swap-on w-5 h-5 fill-current" xmlns="http://www.w3.org/2000/svg"
                             viewBox="0 0 24 24">
                            <path d="M5.64,17l-.71.71a1,1,0,0,0,0,1.41,1,1,0,0,0,1.41,0l.71-.71A1,1,0,0,0,5.64,17ZM5,12a1,1,0,0,0-1-1H3a1,1,0,0,0,0,2H4A1,1,0,0,0,5,12Zm7-7a1,1,0,0,0,1-1V3a1,1,0,0,0-2,0V4A1,1,0,0,0,12,5ZM5.64,7.05a1,1,0,0,0,.7.29,1,1,0,0,0,.71-.29,1,1,0,0,0,0-1.41l-.71-.71A1,1,0,0,0,4.93,6.34Zm12,.29a1,1,0,0,0,.7-.29l.71-.71a1,1,0,1,0-1.41-1.41L17,5.64a1,1,0,0,0,0,1.41A1,1,0,0,0,17.66,7.34ZM21,11H20a1,1,0,0,0,0,2h1a1,1,0,0,0,0-2Zm-9,8a1,1,0,0,0-1,1v1a1,1,0,0,0,2,0V20A1,1,0,0,0,12,19ZM18.36,17A1,1,0,0,0,17,18.36l.71.71a1,1,0,0,0,1.41,0,1,1,0,0,0,0-1.41ZM12,6.5A5.5,5.5,0,1,0,17.5,12,5.51,5.51,0,0,0,12,6.5Zm0,9A3.5,3.5,0,1,1,15.5,12,3.5,3.5,0,0,1,12,15.5Z"/>
                        </svg>
                        <svg class="swap-off w-5 h-5 fill-current" xmlns="http://www.w3.org/2000/svg"
                             viewBox="0 0 24 24">
                            <path d="M21.64,13a1,1,0,0,0-1.05-.14,8.05,8.05,0,0,1-3.37.73A8.15,8.15,0,0,1,9.08,5.49a8.59,8.59,0,0,1,.25-2A1,1,0,0,0,8,2.36,10.14,10.14,0,1,0,22,14.05,1,1,0,0,0,21.64,13Zm-9.5,6.69A8.14,8.14,0,0,1,7.08,5.22v.27A10.15,10.15,0,0,0,17.22,15.63a9.79,9.79,0,0,0,2.1-.22A8.11,8.11,0,0,1,12.14,19.73Z"/>
                        </svg>
                    </label>
                </div>
            </div>
        </div>
        <div class="py-4 px-2">{% block content %}{% endblock %}</div>
    </div>
    <div class="drawer-side shadow dark:shadow-slate-800 z-[50]">
        <label for="my-drawer-2" aria-label="close sidebar" class="drawer-overlay"></label>
        <aside class="min-h-screen bg-base-100 w-64">
            <div class="h-16 sticky top-0 z-[50] shadow dark:shadow-slate-800 flex justify-center items-center">
                <span class="animate-rotate_windmill mr-1">
                    <svg t="1720802925901" class="icon h-8 w-8" viewBox="0 0 1027 1024" version="1.1"
                         xmlns="http://www.w3.org/2000/svg" p-id="4906"><path
                            d="M769.80326 298.596309l-150.463892 216.578187 69.559445-0.090543z" opacity=".14"
                            p-id="4907"></path><path
                            d="M513.576417 10.018552a16.587426 16.587426 0 0 0-10.584444 15.482805l0.638326 490.909047a16.582899 16.582899 0 0 0 16.582899 16.560263h30.467625c4.395849 0 8.606086-1.752002 11.72981-4.853089l217.795986-217.800514a16.573845 16.573845 0 0 0 0.529675-22.902781l-248.901938-273.099479a16.591953 16.591953 0 0 0-18.257939-4.296252z"
                            fill="#F78383" p-id="4908"></path><path
                            d="M757.557357 286.133104l-248.272665 217.795986a16.573845 16.573845 0 1 0 10.928506 29.055159h168.748995a16.591953 16.591953 0 0 0 15.582402-10.89229l79.519144-217.800513a16.582899 16.582899 0 0 0-26.506382-18.158342z"
                            fill="#F78383" p-id="4909"></path><path
                            d="M291.266876 255.878254L18.153815 504.793773a16.573845 16.573845 0 1 0 11.186553 28.842383l490.909047-0.638326a16.569318 16.569318 0 0 0 16.551209-16.578372v-30.476679c0-4.395849-1.747474-8.61514-4.857617-11.725283L314.156076 256.412456a16.573845 16.573845 0 0 0-22.8892-0.534202z"
                            fill="#5FD4FF" p-id="4910"></path><path
                            d="M1010.909469 499.315938l-490.913573 0.647381a16.569318 16.569318 0 0 0-16.560264 16.573845v30.476679c0 4.395849 1.747474 8.610613 4.857617 11.734337l217.800513 217.786931a16.582899 16.582899 0 0 0 22.902781 0.529675l273.099479-248.901937a16.578372 16.578372 0 0 0-11.186553-28.846911z"
                            fill="#FFBF00" p-id="4911"></path><path
                            d="M288.754316 258.766567a16.569318 16.569318 0 0 0 1.217799 20.304205l217.795986 248.268138a16.560263 16.560263 0 0 0 18.298684 4.581462 16.587426 16.587426 0 0 0 10.738366-15.519022V347.652355c0-6.971789-4.346051-13.192074-10.887762-15.573348L308.121403 252.56439a16.560263 16.560263 0 0 0-19.367087 6.202177z"
                            fill="#5FD4FF" p-id="4912"></path><path
                            d="M514.178526 501.022669a16.578372 16.578372 0 0 0-10.738367 15.519022v168.748994c0 6.967262 4.355105 13.192074 10.892289 15.577875l217.800513 79.514617a16.578372 16.578372 0 0 0 18.153816-26.506381l-217.795986-248.277193a16.614589 16.614589 0 0 0-18.312265-4.576934z"
                            fill="#FFBF00" p-id="4913"></path><path
                            d="M489.777263 499.918047c-4.404903 0-8.610613 1.742947-11.725283 4.857617l-217.800513 217.795986a16.596481 16.596481 0 0 0-0.529675 22.902781l248.915519 273.104007a16.587426 16.587426 0 0 0 18.25794 4.296252 16.614589 16.614589 0 0 0 10.579917-15.49186l-0.638327-490.904519a16.582899 16.582899 0 0 0-16.582899-16.564791h-30.476679z"
                            fill="#00CCC6" p-id="4914"></path><path
                            d="M351.486839 499.918047a16.560263 16.560263 0 0 0-15.56882 10.887762l-79.514617 217.805041a16.573845 16.573845 0 0 0 6.215758 19.36256 16.578372 16.578372 0 0 0 20.299677-1.213272l248.272666-217.795986a16.555736 16.555736 0 0 0 4.576934-18.312265 16.569318 16.569318 0 0 0-15.509968-10.738367H351.486839z"
                            fill="#00CCC6" p-id="4915"></path></svg>
                </span>
                <span class="text-2xl font-bold tracking-wider">
                    {% if current_user.authority == 2 %}
                        数据管理
                    {% else %}
                        数据预览
                    {% endif %}
                </span>
            </div>
            <ul class="menu text-base-content min-h-full w-64 p-4 gap-2">
                {% macro menu_active(path, menu_name) %}
                    {% if request.path == url_for(path) %}
                        <li><a href="{{ url_for(path) }}" class="active">{{ menu_name }}</a></li>
                    {% else %}
                        <li><a href="{{ url_for(path) }}">{{ menu_name }}</a></li>
                    {% endif %}
                {% endmacro %}
                {% macro menu(path, menu_name, authority=none) %}
                    {% if authority %}
                        {% if current_user.authority == authority %}
                            {{ menu_active(path, menu_name) }}
                        {% endif %}
                    {% elif authority is none %}
                        {{ menu_active(path, menu_name) }}
                    {% endif %}
                {% endmacro %}
                <!-- Sidebar content here -->
                <li class="menu-title cursor-default">
                    {% if current_user.is_authenticated %}
                        <div class="join text-lg items-center dark:text-gray-400 truncate">
                            <div class="join-item mr-2" id="greeting-icon"></div>
                            <div class="join-item" id="greeting"></div>
                            <div class="join-item">，{{ current_user.username }}</div>
                        </div>
                    {% endif %}

                </li>
                {{ menu('admin.index', '电影数据预览') }}
                {{ menu('admin.movie_manage', '电影数据管理', 2) }}
                {{ menu('admin.user_manage', '用户数据管理', 2) }}
                {{ menu('admin.user_info', '个人信息', 1) }}
                {{ menu('admin.spider', '运行爬虫', 2) }}
                {{ menu('admin.spider_code', '爬虫代码', 1) }}
                {{ menu('index.index', '返回首页') }}
                {{ menu('auth.logout', '退出登录') }}

            </ul>
        </aside>
    </div>
</div>

<script>let onload_list = []</script>
<script src="{{ url_for('static', filename='js/iziToast.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/get-time.js') }}"></script>
<script src="{{ url_for('static', filename='js/set-theme.js') }}"></script>
<script src="{{ url_for('static', filename='js/tools.js') }}"></script>
{% block js %}{% endblock %}
{% include 'flash_macro.html' %}
<script>
    window.onload = function () {
        configTheme()
        let mask = document.getElementById('masks');
        if (mask) {
            setTimeout(function () {
                mask.classList.add('animate-mask_out');
            }, 800)
            setTimeout(function () {
                mask.remove();
            }, 1500)
        }
        for (let i = 0; i < onload_list.length; i++) {
            onload_list[i]()
        }
    }
</script>
</body>
</html>